<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div class="box">
        <div class="a"></div>
        <h3></h3>
    </div>

    <script>

        // 替换子元素  replaceChild(新的，旧的)

        // innerHTML 全部替换

        var oBox = document.querySelector('.box');

        var oP = document.createElement('p');
        var oA = document.querySelector('.a');
        oBox.replaceChild(oP, oA);

    </script>

</body>

</html>